package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicProductionDispatchingItemDAO;
import com.cssy.xxkj.logic.entity.LogicProductionDispatchingItemDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-09-28
 */
public class LogicProductionDispatchingItemDAOImpl extends SqlMapClientDaoSupport implements LogicProductionDispatchingItemDAO {

    /**
     * 插入数据
     * @param logicProductionDispatchingItemDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionDispatchingItemDO(LogicProductionDispatchingItemDO logicProductionDispatchingItemDO) {
        Object id = getSqlMapClientTemplate().insert("LogicProductionDispatchingItem.insert", logicProductionDispatchingItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionDispatchingItemDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionDispatchingItemDOByExample(LogicProductionDispatchingItemDO logicProductionDispatchingItemDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDispatchingItem.countByDOExample", logicProductionDispatchingItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionDispatchingItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionDispatchingItemDO(LogicProductionDispatchingItemDO logicProductionDispatchingItemDO) {
        int result = getSqlMapClientTemplate().update("LogicProductionDispatchingItem.update", logicProductionDispatchingItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionDispatchingItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionDispatchingItemDO> findListByExample(LogicProductionDispatchingItemDO logicProductionDispatchingItemDO) {
        List<LogicProductionDispatchingItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDispatchingItem.findListByDO", logicProductionDispatchingItemDO);
        return list;
    }

    /**
     * 根据主键获取logicProductionDispatchingItemDO
     * @param id
     * @return logicProductionDispatchingItemDO
     */
    public LogicProductionDispatchingItemDO findLogicProductionDispatchingItemDOByPrimaryKey(String id) {
        LogicProductionDispatchingItemDO logicProductionDispatchingItemDO = (LogicProductionDispatchingItemDO) getSqlMapClientTemplate().queryForObject("LogicProductionDispatchingItem.findByPrimaryKey", id);
        return logicProductionDispatchingItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionDispatchingItemDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionDispatchingItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionDispatchingItemDO> find(SearchConditions scs)
			throws DataAccessException {
		 List<LogicProductionDispatchingItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDispatchingItem_ex.find", scs);
	        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		 Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDispatchingItem_ex.count", scs);
	        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		 return null;
	}

	@Override
	public Integer deleteDispatId(String id) {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionDispatchingItem_ex.deleteDispatId", id);
        return rows;
	}

}